import http from "@/api";
import { Dispatch, OrderDetail, SortDetail } from "@/api/interface/city/dispatch";

// 待分拣订单列表
export const getDispatchListAPI = (params: Dispatch.SortParams) => {
  return http.get<Dispatch.Sort[]>("/manager/sortingOrder", params);
};
// 待分拣订单详情
export const getDispatchDetailAPI = (orderId: number) => {
  return http.get<SortDetail.Data>(`/manager/sortingOrder/${orderId}`);
};
// 查询订单列表
export const getDispatchOrderListAPI = (params: Dispatch.SelectParams) => {
  return http.get<Dispatch.Select[]>("/manager/order", params);
};
//查询待分拣员列表
export const getDispatchDriverListAPI = (params: { stationId: string }) => {
  return http.get<
    {
      fullName: string;
      orderNum: number;
      userId: number;
    }[]
  >("/manager/sorter/list", params);
};
// 分拣派单给配送员
export const dispatchOrderAPI = (data: { orderId: number; userId: number }) => {
  return http.post("/manager/order/transferToSorter", data);
};

// 订单详情
export const getOrderDetailAPI = (orderId: number) => {
  return http.get<OrderDetail.Data>(`/manager/order/${orderId}`);
};
// 订单详情派送
export const dispatchOrderDetailAPI = (data: { orderId: string; userId: number }) => {
  return http.post("/manager/order/transferToDeliveryMan", data);
};
// 查询配送员列表
export const getDeliveryManListAPI = (params: { stationId: string }) => {
  return http.get<
    {
      fullName: string;
      orderNum: number;
      userId: number;
      longitude: number;
      latitude: number;
    }[]
  >("/manager/deliveryman/optionalLists", params);
};
